<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/3/15 0015
 * Time: 上午 10:54
 */

namespace app\admin\model;


use think\Model;
use think\Db;
class videoList extends Model
{
    public function info()
    {
        $video=Db::table('hy_video_list')->select();
        return $this->tags($video);
    }

    public function getInfo($id)
    {
        $video=Db::table('hy_video_list')->where('vid',$id)->find();
        $class_type=Db::table('hy_video_class')->where('pid',0)->select();
        $data['video']=$video;
        $data['class']=$class_type;
        return $data;
    }

    public function tags($tags)
    {
        foreach ($tags as $k=>$v)
        {
            $class_name=Db::table('hy_video_class')->where('id',$v['classtype'])->find();
            if($v['shell']==1)
            {
                $tags[$k]['shell']='VIP可看';
            }elseif($v['shell']==0)
             {
                 $tags[$k]['shell']='全部人可看';
             }
            $tags[$k]['classtype']=$class_name['classtype'];
        }
        return $tags;
    }

}